import Vue from 'vue';
import Router from'vue-router';

const Home = ()  => import('@/view/home.vue');
const Banner = ()  => import('@/view/banner.vue');
const Barchar = ()  => import('@/view/workBench/barchar.vue');
const Apply = ()  => import('@/view/workBench/apply.vue');
const Test = ()  => import('@/view/workBench/test.vue');
const Task = ()  => import('@/view/workBench/task.vue');
const Birthday = ()  => import('@/view/workBench/birthday.vue');
const Record = ()  => import('@/view/workBench/record.vue');
const Metting = ()  => import('@/view/workBench/metting.vue');
const Exchange = ()  => import('@/view/workBench/exchange.vue');
const Release = ()  => import('@/view/release.vue');
const Ranking = ()  => import('@/view/ranking.vue');
const Contact = ()  => import('@/view/myfolder/contact.vue');
const Feedback = ()  => import('@/view/myfolder/feedback.vue');
const Statistics = ()  => import('@/view/myfolder/statistics.vue');
const Hellp = ()  => import('@/view/myfolder/hellp.vue');
const Goods = ()  => import('@/view/myfolder/goods.vue');
const Clock = ()  => import('@/view/myfolder/clock.vue');
const Attendance = ()  => import('@/view/myfolder/attendance.vue');
const Integral = ()  => import('@/view/myfolder/integral.vue');
const IntegralD = ()  => import('@/view/myfolder/integralD.vue');
const Introduce = ()  => import('@/view/myfolder/introduce.vue');
const RankingChange = ()  => import('@/view/myfolder/rankingChange.vue');
const My_c = ()  => import('@/view/myfolder/my_c.vue');
const Blessings = ()  => import('@/view/myfolder/blessings.vue');
const Transformation = ()  => import('@/view/myfolder/transformation.vue');
const AwardDeduction = ()  => import('@/view/myfolder/awardDeduction.vue');
const IntegralChange = ()  => import('@/view/myfolder/integralChange.vue');
const Personaldata = ()  => import('@/view/myfolder/personaldata.vue');
const DepartmentalStatistics = ()  => import('@/view/myfolder/departmentalStatistics.vue');
const Progress = ()  => import('@/view/myfolder/progress.vue');
const Fabulous = ()  => import('@/view/myfolder/fabulous.vue');
const Details = ()  => import('@/view/workBench/details.vue');
const IntegralDetails = ()  => import('@/view/workBench/integralDetails.vue');
const Follow = ()  => import('@/view/follow.vue');
const FollowDetails = ()  => import('@/view/followDetails.vue');
const ToExamine = ()  => import('@/view/workBench/toExamine.vue');
const Nail = ()  => import('@/view/myfolder/nail.vue');
const Motion = ()  => import('@/view/myfolder/motion.vue');
const Initial = ()  => import('@/view/workBench/initial.vue');
const End = ()  => import('@/view/workBench/end.vue');
const Commodity = ()  => import('@/view/workBench/commodity.vue');
const MettingDetails = ()  => import('@/view/workBench/mettingDetails.vue');
const BirthdayDetails = ()  => import('@/view/workBench/birthdayDetails.vue');
const RewardPunishment = ()  => import('@/view/myfolder/rewardPunishment.vue');
const Details_recruit = ()  => import('@/view/workBench/details_recruit.vue');
const Responsibility = ()  => import('@/view/workBench/responsibility.vue');
const Check_list = ()  => import('@/view/workBench/check_list')
const Automatic = ()  => import('@/view/myfolder/automatic.vue');
const TaskStatistics = ()  => import('@/view/myfolder/TaskStatistics.vue');
const workBenchs = ()  => import('@/view/workbenchs/workbenchs.vue');
const Setup = ()  => import('@/view/workBenchs/setup.vue')
const Yuanbao = ()  => import('@/view/yuanbao.vue')
const Power = ()  => import('@/view/power.vue')
const YbTransformation = ()  => import('@/view/myfolder/YbTransformation.vue')
const Care = ()  => import('@/view/care/care.vue')
const Setting = ()  => import('@/view/care/setting.vue')
const ActivityPunch = ()  => import('@/view/myfolder/activityPunch.vue')
const MyBadge = ()  => import('@/view/workBenchs/MyBadge.vue')
const MyComplete = ()  => import('@/view/workBench/myComplete.vue')
const RecordT = ()  => import('@/view/workBench/recordT.vue')
const Errored = ()  => import('@/view/error.vue')
import { Toast } from 'vant';
Vue.use(Router).use(Toast);

const router = new Router({
  routes: [
    {
    path: '/',
    name: 'banner',
    component: Banner,
    meta:{isShow:true}
  } ,
  {
    path: '/error',
    name: 'error',
    component: Errored,
    meta:{isShow:true}
  },
  {
    path: '/myBadge',
    name: 'myBadge',
    component: MyBadge,
  },
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/barchar',
    name: 'barchar',
    component: Barchar
  },
  {
    path: '/apply',
    name: 'apply',
    component: Apply,
    meta:{isShow:true}
  },{
    path: '/test',
    name: 'test',
    component: Test,
    meta:{isShow:true}
  },{
    path: '/task',
    name: 'task',
    component: Task
  },{
    path: '/birthday',
    name: 'birthday',
    component: Birthday
  },
    {
      path:'/record',
      name:'record',
      component:Record
    },
    
    {
      path:'/metting',
      name:'metting',
      component:Metting
    },
    {
      path:'/exchange',
      name:'exchange',
      component:Exchange
    },
    {
      path:'/release',
      name:'release',
      component:Release,
      meta:{isShow:true}
    },
    {
      path:'/ranking',
      name:'ranking',
      component:Ranking
    },
    {
      path:'/contact',
      name:'/contact',
      component:Contact
    },
    {
      path:'/feedback',
      name:'/feedback',
      component:Feedback
    },
    {
      path:'/statistics',
      name:'/statistics',
      component:Statistics
    },
    {
      path:'/hellp',
      name:'/hellp',
      component:Hellp
    },
    {
      path:'/goods',
      name:'/goods',
      component:Goods
    },
    {
      path:'/clock',
      name:'/clock',
      component:Clock
    },{
      path:'/attendance',
      name:'/attendance',
      component:Attendance
    },{
      path:'/integral',
      name:'/integral',
      component:Integral
    },{
      path:'/integralD',
      name:'/integralD',
      component:IntegralD
    },
    {
      path:'/introduce',
      name:'/introduce',
      component:Introduce
    },{
      path:'/rankingChange',
      name:'/pairankingChangeming',
      component:RankingChange
    },{
      path:'/my_c',
      name:'/my_c',
      component:My_c
    },{
      path:'/blessings',
      name:'/blessings',
      component:Blessings
    },{
      path:'/transformation',
      name:'/transformation',
      component:Transformation
    },
    {
      path:'/awardDeduction',
      name:'/awardDeduction',
      component:AwardDeduction
    },
    {
      path:'/integralChange',
      name:'/integralChange',
      component:IntegralChange
    },
    {
      path:'/personaldata',
      name:'/personaldata',
      component:Personaldata
    },{
      path:'/departmentalStatistics',
      name:'/departmentalStatistics',
      component:DepartmentalStatistics
    },
    {
      path:'/progress',
      name:'/progress',
      component:Progress
    },{
      path:'/fabulous',
      name:'/fabulous',
      component:Fabulous
    },{
      path:'/details',
      name:'/details',
      component:Details
    },{
      path:'/integralDetails',
      name:'/integralDetails',
      component:IntegralDetails
    },
    {
      path:'/follow',
      name:'/follow',
      component:Follow
    },{
      path:'/followDetails',
      name:'/followDetails',
      component:FollowDetails
    },{
      path:'/toExamine',
      name:'/toExamine',
      component:ToExamine
    },{
      path:'/nail',
      name:'/nail',
      component:Nail
    },{
      path:'/motion',
      name:'/motion',
      component:Motion
    },{
      path:'/initial',
      name:'/initial',
      component:Initial
    },{
      path:'/end',
      name:'/end',
      component:End
    },{
      path:'/rewardPunishment',
      name:'/rewardPunishment',
      component:RewardPunishment
    },{
      path:'/birthdayDetails',
      name:'/birthdayDetails',
      component:BirthdayDetails,
      meta:{isShow:true}
    },{
      path:'/commodity',
      name:'/commodity',
      component:Commodity
    },{
      path:'/mettingDetails',
      name:'/mettingDetails',
      component:MettingDetails
    },
    {
      path:'/details_recruit',
      name:'/details_recruit',
      component:Details_recruit,
      meta:{isShow:true}
    },{
      path:'/responsibility',
      name:'/responsibility',
      component:Responsibility,
      meta:{isShow:true}
    },{
      path:'/check_list',
      name:'/check_list',
      component:Check_list,
      meta:{isShow:true}
    },{
      path:'/automatic',
      name:'/automatic',
      component:Automatic
    },{
      path:'/TaskStatistics',
      name:'/TaskStatistics',
      component:TaskStatistics
    },
    {
      path: '/workbenchs',
      name: 'workBenchs',
      component: workBenchs
    },
    {
      path: '/setup',
      name:'setup',
      component: Setup,
      meta: {keepAlive: true }
    },
    {
      path: '/yuanbao',
      name:'yuanbao',
      component: Yuanbao,
    },
    {
      path: '/power',
      name:'power',
      component: Power,
      meta:{isShow:true}
    },
    {
      path: '/YbTransformation',
      name:'YbTransformation',
      component: YbTransformation,
    },
    {
      path: '/care',
      name: 'care',
      component: Care
    },
    {
      path: '/setting',
      name:'setting',
      component: Setting,
    },
    {
      path:'/activityPunch',
      name:'/activityPunch',
      component:ActivityPunch
    },{
      path:'/myComplete',
      name:'/myComplete',
      component:MyComplete
    },
    {
      path:'/recordT',
      name:'/recordT',
      component:RecordT
    }
  ]
})


router.onError((error) => {
 const pattern = /Loading chunk (\d)+ failed/g;
 const isChunkLoadFailed = error.message.match(pattern);
 const targetPath = router.history.pending.fullPath;
 if (isChunkLoadFailed) {
  router.replace(targetPath);
 }
})
export default router;
